/**
* 代码为自动生成 Created by www.magicalcoder.com
* 如果你改变了此类 read 请将此行删除
* 欢迎加入官方QQ群:323237052
*/

layui.config({base : "assets/"}).extend({"iotequipment_config":"admin/iotequipment/iotequipment-config","magicalcoderlist" : "magicalcoder/v001/rmp/magicalcoderlist"})
layui.use(["magicalcoderlist","iotequipment_config"],function(){
    var config = $.extend(layui.iotequipment_config,{
        layTable : {
            //表格内容
            elem : '#newsList',
            id : "newsListTable"
            },
            //排序跟数据库实际字段名的映射
        sortMap:{
            equipmentId:'equipment_id',productLineId:'product_line_id',equipmentTypeId:'equipment_type_id',equipmentCode:'equipment_code',equipmentName:'equipment_name',equipmentStatus:'equipment_status',equipmentIp:'equipment_ip',equipmentStartTime:'equipment_start_time',equipmentEndTime:'equipment_end_time',gatewayId:'gateway_id',equipmentImage:'equipment_image',equipmentManager:'equipment_manager',equipmentBrand:'equipment_brand',equipmentSupplier:'equipment_supplier',equipmentPrice:'equipment_price',remarks:'remarks',creationTime:'creation_time',creationUser:'creation_user',updateTime:'update_time',updateUser:'update_user',spare1:'spare1',spare2:'spare2',spare3:'spare3'
        }
    });
    var  magicalcoderlist = layui.magicalcoderlist(config);
    //绑定所有查询区域控件
    magicalcoderlist.bindQueryArea();
    //表格
    var cols = [[
        {type: "checkbox", fixed:"left", width:50},
                {field: 'equipmentId', title: '设备ID', minWidth:100, align:"center",sort:true},
            {field: 'productLineId', title: '产线ID',minWidth:350, align:'center', templet:'#productLineIdTemplate',sort:true},
            {field: 'equipmentTypeId', title: '设备类型ID',minWidth:350, align:'center', templet:'#equipmentTypeIdTemplate',sort:true},

            {field: 'equipmentCode', title: '设备编码', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentCode) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentCode" name="equipmentCode" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="设备编码"/>'
                }
                , sort:true
            },

            {field: 'equipmentName', title: '设备名称', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentName) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentName" name="equipmentName" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="设备名称"/>'
                }
                , sort:true
            },

            {field: 'equipmentStatus', title: '设备状态', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentStatus) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentStatus" name="equipmentStatus" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="设备状态"/>'
                }
                , sort:true
            },

            {field: 'equipmentIp', title: '设备IP地址', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentIp) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentIp" name="equipmentIp" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="设备IP地址"/>'
                }
                , sort:true
            },

            {field: 'equipmentStartTime', title: '开始日期', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentStartTime) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentStartTime" name="equipmentStartTime" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="开始日期"/>'
                }
                , sort:true
            },

            {field: 'equipmentEndTime', title: '报废日期', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentEndTime) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentEndTime" name="equipmentEndTime" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="报废日期"/>'
                }
                , sort:true
            },

            {field: 'gatewayId', title: '连接网关ID', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.gatewayId) +'" class="magicalcoder-table-text layui-input security_list_table_form_gatewayId" name="gatewayId" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="连接网关ID"/>'
                }
                , sort:true
            },

            {field: 'equipmentImage', title: '设备图片地址', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentImage) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentImage" name="equipmentImage" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="设备图片地址"/>'
                }
                , sort:true
            },

            {field: 'equipmentManager', title: '责任人', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentManager) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentManager" name="equipmentManager" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="责任人"/>'
                }
                , sort:true
            },

            {field: 'equipmentBrand', title: '品牌', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentBrand) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentBrand" name="equipmentBrand" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="品牌"/>'
                }
                , sort:true
            },

            {field: 'equipmentSupplier', title: '供应商', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentSupplier) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentSupplier" name="equipmentSupplier" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="供应商"/>'
                }
                , sort:true
            },

            {field: 'equipmentPrice', title: '设备价格', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.equipmentPrice) +'" class="magicalcoder-table-text layui-input security_list_table_form_equipmentPrice" name="equipmentPrice" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="设备价格"/>'
                }
                , sort:true
            },

            {field: 'remarks', title: '备注', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.remarks) +'" class="magicalcoder-table-text layui-input security_list_table_form_remarks" name="remarks" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="备注"/>'
                }
                , sort:true
            },

            {field: 'creationTime', title: '创建时间', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.creationTime) +'" class="magicalcoder-table-text layui-input security_list_table_form_creationTime" name="creationTime" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="创建时间"/>'
                }
                , sort:true
            },

            {field: 'creationUser', title: '创建人', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.creationUser) +'" class="magicalcoder-table-text layui-input security_list_table_form_creationUser" name="creationUser" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="创建人"/>'
                }
                , sort:true
            },

            {field: 'updateTime', title: '更新时间', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.updateTime) +'" class="magicalcoder-table-text layui-input security_list_table_form_updateTime" name="updateTime" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="更新时间"/>'
                }
                , sort:true
            },

            {field: 'updateUser', title: '更新人', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.updateUser) +'" class="magicalcoder-table-text layui-input security_list_table_form_updateUser" name="updateUser" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="更新人"/>'
                }
                , sort:true
            },

            {field: 'spare1', title: '备用1', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.spare1) +'" class="magicalcoder-table-text layui-input security_list_table_form_spare1" name="spare1" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="备用1"/>'
                }
                , sort:true
            },

            {field: 'spare2', title: '备用2', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.spare2) +'" class="magicalcoder-table-text layui-input security_list_table_form_spare2" name="spare2" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="备用2"/>'
                }
                , sort:true
            },

            {field: 'spare3', title: '备用3', minWidth:200,templet:function (d) {
                    return '<input type="text" value="'+ magicalcoderlist.escapeHTML(d.spare3) +'" class="magicalcoder-table-text layui-input security_list_table_form_spare3" name="spare3" data-identify="'+d.equipmentId+'" lay-verify="magicalCoderVerify" magicalcoder-verify=""  placeholder="备用3"/>'
                }
                , sort:true
            },
        {title: '操作', minWidth:250, templet:'#newsListOperateTemplate',fixed:"right",align:"center"}
    ]];
    //表格中的一些事件
    var tableEvent = {
        "tool":function (obj,roleId) {//操作部分的按钮
            return true;//不阻止事件继续执行封装的事件
        },
        "sort":function (obj,safeOrderBy) {//排序
            return true;//不阻止事件继续执行封装的事件
        }
    }
    magicalcoderlist.bindTableArea(cols,tableEvent)
    magicalcoderlist.bindAreaEvents();
})
